//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "uEditAccounts.h"
#include "uGlobalVar.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "NxInspector"
#pragma link "NxScrollControl"
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxDropDownEdit"
#pragma link "cxEdit"
#pragma link "cxGraphics"
#pragma link "cxImageComboBox"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxMaskEdit"
#pragma link "cxTextEdit"
#pragma link "NxPropertyItemClasses"
#pragma link "NxPropertyItems"
#pragma resource "*.dfm"
TfrEditAccounts *frEditAccounts;
//_AOPTION AOptions;
//---------------------------------------------------------------------------
__fastcall TfrEditAccounts::TfrEditAccounts(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::ntmTypeConnectCloseUp(TNxPropertyItem *Sender)
{
	bool itmVisible;
	if (ntmTypeConnect->ItemIndex < 2) itmVisible = True; else itmVisible = False;
	SetVisibleItem(itmVisible);
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::FormKeyPress(TObject *Sender, char &Key)
{
	if (Key == 27)
	{
  	this->Close();
	}
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::ntmConvertInToolButtonClick(
      TNxPropertyItem *Sender, int ButtonIndex)
{
	if (!ntmConvertIn->AsBoolean)
	{
		ntmConvertIn->SuffixValue = "";
	}
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::ntmConvertOutToolButtonClick(
      TNxPropertyItem *Sender, int ButtonIndex)
{
	if (!ntmConvertOut->AsBoolean)
	{
		ntmConvertOut->SuffixValue = "";
	}
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::ntmPackedToolButtonClick(
			TNxPropertyItem *Sender, int ButtonIndex)
{
	if (!ntmPacked->AsBoolean)
	{
		ntmPacked->SuffixValue = "";
	}
}
//---------------------------------------------------------------------------

void __fastcall TfrEditAccounts::FormShow(TObject *Sender)
{
	bool itmVisible;
	if (AOptions.TypeConnection < 2) itmVisible = True; else itmVisible = False;
	SetVisibleItem(itmVisible);
}
//---------------------------------------------------------------------------
void __fastcall TfrEditAccounts::SetVisibleItem(bool _Visible)
{
  ntmServer->Visible = _Visible;
	ntmPort->Visible   = _Visible;
	ntmUser->Visible   = _Visible;
	ntmPass->Visible   = _Visible;
	ntmPassiveMode->Visible = _Visible;
	ntmInFolder->Visible  = !_Visible;
	ntmOutFolder->Visible = !_Visible;
}
